package com.mybd.req.two;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * @author: Scq
 * @time: 2021/6/511:10
 */
public class MyPartition extends Partitioner<Text, NullWritable> {
    @Override
    public int getPartition(Text text, NullWritable nullWritable, int i) {
        String[] split = text.toString().split(",");
        if ("10".equals(split[split.length - 1])) {
            return 0;
        } else if ("20".equals(split[split.length - 1])) {
            return 1;
        } else {
            return 2;
        }
    }
}
